﻿

  <!-- /PAGE HEADER -->
  <!-- FORMS -->
  <div class="row">
      <div class="col-md-12">
          <div class="row">
              <div class="col-md-6">
                  <!-- BASIC -->
                  <div class="box border orange">
                      <div class="box-title">
                          <h4><i class="fa fa-bars"></i>管理员添加</h4>
                          <div class="tools hidden-xs">
                              <a href="#box-config" data-toggle="modal" class="config">
                                  <i class="fa fa-cog"></i>
                              </a>
                              <a href="javascript:;" class="reload">
                                  <i class="fa fa-refresh"></i>
                              </a>
                              <a href="javascript:;" class="collapse">
                                  <i class="fa fa-chevron-up"></i>
                              </a>
                              <a href="javascript:;" class="remove">
                                  <i class="fa fa-times"></i>
                              </a>
                          </div>
                      </div>
                      <div class="box-body big">




                          <form class="form-horizontal" action="" method="post" role="form"  enctype="multipart/form-data">

                            <div class="form-group">
                              <label for="inputEmail3" class="col-sm-2 control-label">用户名</label>
                              <div class="col-sm-10">
                                <input type="text" name="name" class="form-control" id="inputEmail3" placeholder="请输入标题">
                              </div>
                            </div>

                            <div class="form-group">
                              <label for="inputEmail3" class="col-sm-2 control-label">用户密码</label>
                              <div class="col-sm-10">
                                <input type="text" name="password" class="form-control" id="inputEmail3" placeholder="请输入标题">
                              </div>
                            </div>

                            <div class="form-group">
                              <label for="inputEmail3" class="col-sm-2 control-label">确认密码</label>
                              <div class="col-sm-10">
                                <input type="text" name="cpassword" class="form-control" id="inputEmail3" placeholder="请输入标题">
                              </div>
                            </div>



                            <div class="form-group">
                              <label for="inputEmail3" class="col-sm-2 control-label">性别</label>
                              <div class="col-sm-10">
                                <label class="radio-inline">
                                <input type="radio" value="1"   class="uniform" name="sex"> 男 </label>
                               <label class="radio-inline">
                               <input type="radio" checked="" value="0"   class="uniform" name="sex"> 女 </label>
                              </div>
                            </div>

                            <div class="form-group">
                              <label for="inputEmail3" class="col-sm-2 control-label">年龄</label>
                          <div class="col-sm-10">
                                <select name="age">
                                    <option value="0">请选择</option>
                                    <option >20</option>
                                    <option >25</option>
                                    <option >30</option>

                                  </select>
                              </div>
                            </div>

                            <div class="form-group">
                              <label for="inputEmail3" class="col-sm-2 control-label">用户手机</label>
                              <div class="col-sm-10">
                                <input type="text" name="cellphone" class="form-control" id="inputEmail3" placeholder="请输入标题">
                              </div>
                            </div>

                            <div class="form-group">
                              <label for="inputEmail3" class="col-sm-2 control-label">用户地址</label>
                              <div class="col-sm-10">
                                <input type="text" name=" user_address" class="form-control" id="inputEmail3" placeholder="请输入标题">
                              </div>
                            </div>

                            <div class="form-group">
                              <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-pink">添加</button>
                              </div>
                            </div>
                          </form>

                      </div>
                  </div>
                  <!-- /BASIC -->
                  <!-- BASIC -->

<script src="resources/admin/js/jquery/jquery-2.0.3.min.js""></script>
<script type="text/javascript">
$(function(){
    $('.list').on('change','select',function(){


            //选中项id值
         var id = $(this).val();
           //删除当前操作之后的所有select标签

         $(this).nextAll().remove();
            //选中的是上一级则终止程序执行
         if($(this).get(0).selectedIndex==0){
               return false;
         }

         //通过ajax获取选中项的子级数据
         $.ajax({
            type:'get',
            url:'index.php?c=cate&a=add&admin=1&id='+id,
            dataType:'json',
            success:function(json){
  // alert(1);
              //将程序返回子级的数据显示在下拉列表中
              var html='';
                html+='<select class="form-control" name="pid">';
                html+='<option value="'+id+'">上一级</option>';

                for(i in json){
                     html+='<option value="'+json[i].id+'">'+json[i].name+'</option>';
                }
                html+='</select>';

                  //将新的下拉列表追加到原来的下拉列表后面
                $('.list').append(html);
            }

         })
      })
})


</script>

